package com.baidu.sggc.data.req;

import lombok.Data;

import java.util.List;

@Data
public class ProductListReq {

  private int pageNum;
  private int pageSize;

  /**
   * 公开可复制，如果传false则设置为null
   */
  private Boolean copyPermission;

  /**
   * 创建产品类型
   */
  private String createTypeFilter;

  /**
   * 标签数组
   */
  private List<String> tagList;

  /**
   * 搜索关键词
   */
  private String keyWord;

  public void validate() {
    if (pageNum < 1) {
      throw new IllegalArgumentException("pageNum cannot be less than 1");
    }
    if (pageSize < 1) {
      throw new IllegalArgumentException("pageSize cannot be less than 1");
    }
    if (copyPermission != null){
      if (copyPermission == false){
        this.setCopyPermission(null);
      }
    }
  }
}
